package net.lb.socketserver.handler.impl;

import javax.annotation.Resource;
import net.lb.socketserver.bus.BusinessCommand;
import net.lb.socketserver.bus.Message;
import net.lb.socketserver.handler.MessageHandler;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

@Resource
public class TestHandler implements MessageHandler
{
    private static int    flag   = 0;
    private static Logger logger = LogManager.getLogger();
    
    @Override
    public byte interestedDataPacketType()
    {
        return BusinessCommand.TEST_SERVER;
    }
    
    @Override
    public void handler(Message message)
    {
        logger.debug("进行测试处理");
        message.getBusinessData().ensureCapacity(4096);
        message.setResult(true);
        flag++;
        logger.debug("第" + flag + "次测试");
    }
    
}
